<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');
$frm=$_SESSION['form_id'];
$id1=$_SESSION['id1'];
$dis_name=$_SESSION['dis_name'];
$qr="select * from tbl_dtls_q2_main where form_id='$frm'";
$res=mysql_query($qr);
$row=mysql_fetch_array($res);
if(isset($_POST['back']))
{ 
	header('Location: view_q2_3.php');
}	
if(isset($_POST['submit']))
{ 
	echo'<span class="successmssg">You have successfully view this Form. Now you can go on <a href="home.php">home</a> page.</span>';
				exit();
}	
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<title>View Q2</title>
<script language=javascript>
function show_NF()
{
	var val=document.getElementById('num').value;
	for(i=1; i<val; i++)
	{
		//alert(document.getElementById('critical'+i).innerHTML);
		if(document.getElementById('critical'+i).innerHTML == "no")
		{
			document.getElementById('crit'+i).style.display = "none";
		}
		else
		{
			document.getElementById('crit'+i).style.display = "block";
		}
		
	}
}
</script>
</head>
<body onLoad="show_NF()">
<div align="center">
<form name="f1" action="" method="post">
	<table border="0" width="750" id="table1" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30" colspan="2">
			<p align="center">
			<font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#000000">
			Questionnaire No. </font><span style="font-weight: 700">
			<font face="Verdana" size="2" color="#000000">2</font></span></td>
		</tr>
		<tr>
			<td height="19" colspan="2">
			<p align="center">
			<font face="Arial" style="font-size: 8.5pt" color="#000000">(For 
			Hand Pump Schemes only)</font></td>
		</tr>
		<tr>
			<td height="18" colspan="2">
				<p align="center">
				<font style="font-size: 8.5pt" face="Arial" color="#000000">Page 4</font></p>			</td>
		</tr>
		<tr>
			<td><span style="font-weight: 700">
			<font face="Arial" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;Form Id = <?php echo $frm?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;District Name = <?php echo $dis_name?></font></span></td>
		</tr>
		<tr><td>&nbsp;</td></tr>
		<tr>
			<td height="22" colspan="2" bgcolor="#EEEEEE"><font color="#000000">&nbsp;
			<span style="font-weight: 700">
			<font face="Arial" style="font-size: 8.5pt">Critical Habitations</font></span>
			</font></td>
		</tr>
		<tr>
			<td colspan="2">
				<table border="1" width="750" id="table2" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
					<tr>
						<td width="226" height="28" align="center"  bgcolor="#F7E6B7">
							<font face="Verdana" style="font-size: 8.5pt" color="#990000">
							Habitation Name</font></td>
							<td width="121" align="center"  bgcolor="#F7E6B7"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Habitation Type</font></td>
						<td width="399"  bgcolor="#F7E6B7" align="center">
							<font face="Verdana" style="font-size: 8.5pt" color="#990000">
							Critical</font></td>
					</tr>
					<?php
						$qr2="select * from tbl_dtls_q2_critical where q2_id='$id1' order by critical_hcode asc";
						$res2=mysql_query($qr2);
						$i=1;
						while($row=mysql_fetch_array($res2))
						{
					?>
				<tr align="center">
				  <td width="226" height="26"><label id="critical_hname"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[critical_hname]";?></font></label></td>
				  	<td align="center" width="121"><label id="type_habit"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[type_habit]";?></font></label></td>
				  <td width="399"><label id="critical<?php echo $i ?>" for="<?php echo "$row[critical]";?>"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[critical]";?></font></label></td>
				</tr> 
					<tr>
						<td></td>
						<td></td>
						<td><div id="crit<?php echo $i ?>">
							<table border="1" width="100%" id="table16" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
							<tr>
								<td height="22" colspan="0" align="center">
								<font face="Verdana" style="font-size: 8.5pt" color="#990000">&nbsp; 
								Critical Village in terms of quality </font>							                        								                                </td>
							</tr>
							<tr>
								<td width="86" height="24" align="center"><label id="CH_quality"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[CH_quality]";?></font></label></td>				  
							</tr>
							<tr>
								<td height="26" colspan="0" align="center">&nbsp;
								<font face="Verdana" style="font-size: 8.5pt" color="#990000">
								Critical Village in terms of quantity </font>            						                       			</td>
							</tr>
							<tr>
							  <td width="86" height="24" align="center"><label id="CH_quantity"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[CH_quantity]";?></font></label></td>
				    		</tr>
						</table>
						</div>					</td>
				</tr>
				<?php
				$i++;
					} ?>
					<input type="hidden" name="num" id="num" value="<?php echo $i;?>">
			</table>		</td>
	</tr>
		<tr>
			<td height="19" colspan="2"><span style="font-size: 4pt">&nbsp;</span></td>
		</tr>
		<tr>
			<td width="227" height="22" bgcolor="#EEEEEE"><font color="#000000">&nbsp;
				<span style="font-weight: 700">
				<font face="Arial" style="font-size: 8.5pt">Water Supply by Tankers</font></span></font></td>
			<!--<td width="523" bgcolor="#EEEEEE"><label id="constraint_operational"><?php //echo "$row[constraint_operational]";?></label></td>-->
		</tr>
		
		<tr>
			<td colspan="2">
				<table border="0" width="100%" id="table6" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
					<tr>
					 <td height="64"><table border="0"  width="100%" id="table8" cellpadding="0" bgcolor="#FDF9EE" cellspacing="0">
                        <tr>
                          <td><div id="tanker">
                            <table border="1" width="750" style="border-collapse:collapse; border-color:#99CCCC;">
                                <tr>
                                  <td width="224" height="29" align="center"  bgcolor="#F7E6B7"><font face="Verdana" style="font-size: 8.5pt" color="#990000"> Habitation Name</font></td>
                                  <td width="125" align="center"  bgcolor="#F7E6B7"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Habitation Type</font></td>
                                  <td width="125"  bgcolor="#F7E6B7" align="center"><address>
                                    <span style="font-style: normal"> <font face="Verdana" style="font-size: 8.5pt" color="#990000"> Tanker Nos.</font></span>
                                  </address></td>
                                  <td width="99"  bgcolor="#F7E6B7" align="center"><address>
                                    <span style="font-style: normal"> <font face="Verdana" style="font-size: 8.5pt" color="#990000"> Quantity (KL) </font></span>
                                  </address></td>
                                  <td width="169"  bgcolor="#F7E6B7" align="center"><address>
                                    <span style="font-style: normal"> <font face="Verdana" style="font-size: 8.5pt" color="#990000"> Area Covered</font></span>
                                  </address></td>
                                </tr>
                             <?php
						$qr2="select * from tbl_dtls_q2_tanker where q2_id='$id1' order by habitation_code asc";
						$res2=mysql_query($qr2);
						while($row=mysql_fetch_array($res2))
						{
					?>
                                <tr align="center">
                                  <td width="224" height="30"><label id="habitation_name"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[habitation_name]";?></font></label></td>
                                  <td align="center" width="125"><label id="type_habit"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[type_habit]";?></font></label></td>
                                  <td width="125"><label id="total_tanker_no"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[total_tanker_no]";?></font></label></td>
                                  <td width="99"><label id="water_quantity"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[water_quantity]";?></font></label></td>
                                  <td width="169"><label id="area_covered"><font face="Verdana" style="font-size: 8.5pt"><?php echo "$row[area_covered]";?></font></label></td>
                                
                        <?php  }?>          
                      </tr>
                              </table>
                          </div></td>
                        </tr>
					  </table></td>
				</tr>
			</table>		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="2">
			<p align="center">
			<input type="submit" value="Back" name="back" style="font-size: 8pt;font-family:Verdana; border-style: solid; border-width: 1px">&nbsp;&nbsp;
			<input type="submit" value="Next" name="submit" style="font-size: 8pt;font-family: Verdana; border-style: solid; border-width: 1px">
		</td>
	</tr>
</table>
</form>
</div>
</body>
</html>
